﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucForumTopics.ascx.cs" Inherits="WCrawler.Controls.ucForumTopics" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
<%@ Register Src="~/Controls/ucTreeViewTopic.ascx" TagName="ucTreeViewTopic" TagPrefix="UserControl" %>
<style type="text/css">
    .style1
    {
        width: 46px;
    }
</style>
<div>

        <asp:Button ID="btnSearchThreads" runat="server" 
            onclick="btnSearchThreads_Click" 
    Text="Search By Checked Threads" />

</div>
<div>
<asp:UpdatePanel ID="SearhThreadUpdatePanel" runat="server">
    <ContentTemplate>
    <div>
                        <h2>
                            <asp:Label ID="lblForum" runat="server"></asp:Label></h2>
                    </div>
        <ajaxToolkit:TabContainer ID="TabContainerPost" runat="server" ActiveTabIndex="0"
            Width="100%">
            <ajaxToolkit:TabPanel ID="TabPanelForumTopic" runat="server" HeaderText="Forum Topics">
                <HeaderTemplate>
                    Forum Topics</HeaderTemplate>
                <ContentTemplate>
                    <table style="width: 100%;">
                        <tr>
                            <td valign="top" class="style2">
                            </td>
                            <td>
                                <asp:CheckBox ID="chkViewEdit" runat="server" AutoPostBack="True" OnCheckedChanged="chkViewEdit_CheckedChanged"
                                    Text="View Edit?" />
                                <asp:Button ID="btnSubmitChanges" runat="server" OnClick="btnSubmitChanges_Click"
                                    Text="Submit Changes" />
                                <asp:Button ID="btnGetTopicLink" runat="server" OnClick="btnGetTopicLink_Click" Text="Get Topic Link" />
                                <asp:Label ID="lblMessage" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" class="style2">
                                <asp:PlaceHolder runat="server" ID="PlaceHolderTreeViewTopic">
                                    <UserControl:ucTreeViewTopic ID="ucTreeViewTopic" runat="server" OnBubbleIndexChanged="ucTreeViewTopic_SelectedIndexChanged" />
                                </asp:PlaceHolder>
                            </td>
                            <td valign="top">
                                <asp:GridView ID="gridViewForumTopic" runat="server" AutoGenerateColumns="False"
                                    BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px"
                                    CellPadding="4" DataKeyNames="ForumId,TopicId" Width="100%" DataSourceID="ForumTopicLinqDataSource"
                                    AllowSorting="True" OnRowDataBound="gridViewForumTopic_RowDataBound">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Thread">
                                            <ItemTemplate>
                                                <asp:Label ID="lblThread" runat="server" Text='<% #Eval("Topic.TopicName")%>'> </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="fValue">
                                            <ItemTemplate>
                                                <asp:Label ID="lblFValue" Visible='<%# !(bool) chkViewEdit.Checked %>' runat="server"
                                                    Text='<% #Eval("fValue")%>'> </asp:Label>
                                                <asp:TextBox ID="txtFValue" Visible='<%# chkViewEdit.Checked %>' runat="server" Text='<% #Eval("fValue")%>'> </asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Topic">
                                            <ItemTemplate>
                                                <%--<asp:Label ID="lblTopicName" Visible='<%# !(bool) chkViewEdit.Checked %>' runat="server" Text='<% #Eval("TopicName")%>'> </asp:Label>--%>
                                                <asp:HyperLink ID="hyperLinkTopic" Visible='<%# !(bool) chkViewEdit.Checked %>' runat="server"
                                                    NavigateUrl='<% #Eval("ForumTopicUrl")%>' Text='<% #Eval("ForumTopicName")%>'
                                                    Width="200px"></asp:HyperLink>
                                                <asp:TextBox ID="txtTopicName" Visible='<%# chkViewEdit.Checked %>' runat="server"
                                                    Text='<% #Eval("ForumTopicName")%>' Width="100px" Height="20px" TextMode="MultiLine"> </asp:TextBox>
                                                <asp:TextBox ID="txtTopicUrl" Visible='<%# chkViewEdit.Checked %>' runat="server"
                                                    Text='<% #Eval("ForumTopicUrl")%>' Width="100px" Height="20px" TextMode="MultiLine"> </asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Prefix">
                                            <ItemTemplate>
                                                <asp:Label ID="lblPrefix" Visible='<%# !(bool) chkViewEdit.Checked %>' runat="server"
                                                    Text='<% #Eval("Prefix")%>'> </asp:Label>
                                                <asp:TextBox ID="txtPrefix" Visible='<%# chkViewEdit.Checked %>' runat="server" Text='<% #Eval("Prefix")%>'> </asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="TopicOrder" SortExpression="Topic.TopicOrder">
                                            <ItemTemplate>
                                                <asp:Label ID="lblTopicOrder" runat="server" Text='<% #Eval("Topic.TopicOrder")%>'> </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                                    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                    <RowStyle BackColor="White" ForeColor="#003399" />
                                    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                    <SortedAscendingCellStyle BackColor="#EDF6F6" />
                                    <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                                    <SortedDescendingCellStyle BackColor="#D6DFDF" />
                                    <SortedDescendingHeaderStyle BackColor="#002876" />
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
            <ajaxToolkit:TabPanel ID="TabPanelSearchTopic" runat="server" HeaderText="Search Topic">
                <HeaderTemplate>
                    Search Topic</HeaderTemplate>
                <ContentTemplate>
                    
                    <div>
                        <table style="width: 100%;">
                            <tr>
                                <td class="style1">
                                    <asp:Label ID="lblXPath" runat="server" Text="XPath"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtXPath" runat="server" Width="100%" AutoPostBack="true"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div>
                        <asp:Button ID="btnSearchBySelectedTopic" runat="server" Text="Search By Selected Topic"
                            OnClick="btnSearchBySelectedThread_Click" />
                        <asp:Button ID="btnUpdateTopics" runat="server" OnClick="btnUpdateThreads_Click"
                            Text="Update Topics" Style="height: 26px" />
                        <asp:Button ID="btnTestXPath" runat="server" OnClick="btnTestXPath_Click" Text="Test XPath"
                            Width="95px" />
                        <br />
                        <asp:Label ID="Label1" runat="server" Text="Topic filter"></asp:Label>
                        <asp:DropDownList ID="DropDownListFilter" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListFilter_SelectedIndexChanged">
                            <asp:ListItem Selected="True" Value="0">Selected Url</asp:ListItem>
                            <asp:ListItem Value="1">Removed Url</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox ID="txtBlackListTitle" runat="server"></asp:TextBox>
                        <asp:Button ID="btnAddBlackListTitle" runat="server" OnClick="btnAddBlackListTitle_Click"
                            Text="Add Blacklist Title" />
                    </div>
                    <asp:GridView ID="gridViewSearchTopic" runat="server" AutoGenerateColumns="False"
                        BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
                        CellPadding="4" DataKeyNames="Id" Width="100%" OnRowDataBound="gridViewSearchTopic_RowDataBound">
                        <EmptyDataTemplate>
                            <asp:Label ID="lblEmptySearchThread" runat="server" Font-Bold="True" ForeColor="#0033CC"> No Results Found....  
                            </asp:Label>
                        </EmptyDataTemplate>
                        <Columns>
                            <asp:TemplateField HeaderText="#" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="lblNum" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Topic" SortExpression="Topic">
                                <ItemTemplate>
                                    <asp:HyperLink ID="hyperLinkTopic" runat="server" NavigateUrl='<%#Eval("Url") %>'
                                        Text='<%#Eval("Topic") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="f" SortExpression="fValue">
                                <ItemTemplate>
                                    <asp:Label ID="lblFValue" runat="server" Text='<%#Eval("fValue") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtFValue" runat="server" Text='<%#Eval("fValue") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Topic" SortExpression="TopicName">
                                <ItemTemplate>
                                    <asp:DropDownList ID="dropDownListTopic" runat="server" DataSourceID="TopicLinqDataSource"
                                        DataTextField="TopicName" DataValueField="TopicId" AppendDataBoundItems="true">
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                        <RowStyle BackColor="White" ForeColor="#330099" />
                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                        <SortedAscendingCellStyle BackColor="#FEFCEB" />
                        <SortedAscendingHeaderStyle BackColor="#AF0101" />
                        <SortedDescendingCellStyle BackColor="#F6F0C0" />
                        <SortedDescendingHeaderStyle BackColor="#7E0000" />
                    </asp:GridView>
                </ContentTemplate>
            </ajaxToolkit:TabPanel>
        </ajaxToolkit:TabContainer>
    </ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:LinqDataSource ID="ForumTopicLinqDataSource" runat="server" 
    ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
    TableName="ForumTopics" 
    EnableInsert="True" EnableUpdate="True" 
    onselecting="ForumThreadDetailsLinqDataSource_Selecting">
</asp:LinqDataSource>
    
<asp:LinqDataSource ID="TopicLinqDataSource" runat="server" 
    ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
    TableName="Topics">
</asp:LinqDataSource>